package com.wanjia.estate.constant;

import lombok.AllArgsConstructor;

import java.util.Objects;
import java.util.stream.Stream;

@AllArgsConstructor
public enum DocumentType {


    CONTRACT("contract", "合同", "合同","0102"),
    INVOICE("invoice", "发票", "发票","0103"),
    REGISTRATION_CERTIFICATE("registrationCertificate", "首次登记证明", "首次登记证明",""),
    SUPPLEMENTAL("supplemental", "补充协议", "补充协议",""),
    CONSIGNMENT("consignment", "委托协议", "委托协议",""),
    ID_CARD_IDENTIFICATION("idCardIdentification", "身份证识别", "身份证识别","0104"),
    PRINT_ZYDJ("printZydj", "镇江市不动产转移登记申请书", "镇江市不动产转移登记申请书",""),
    PRINT_SJD("printSjd", "收件单", "收件单",""),
    PRINT_YDZFKPLXD("printYdzfkplxd", "联系单", "联系单",""),
    PRINT_ZJSBDCJYSBD("Zjsbdcjysbd", "镇江市不动产交易申报单", "镇江市不动产交易申报单","0101"),
    PRINT_ZLF("printZlf", "增量房交易申报表", "增量房交易申报表",""),
    JHZ("jhz", "结婚证", "结婚证","0105"),
    HKB("hkb", "户口簿", "户口簿","0104"),
    JTZFTCCX("tc","家庭住房套次查询证明","家庭住房套次查询证明","0107"),
    WSZM("wszm","完税证明","完税证明",""),
    CXDBS("cns","诚信担保书","诚信担保书","0108"),
    PZ("pz","拍照留存","拍照留存",""),
    JMYDS("jmyds","减名约定书","减名约定书",""),
    JMCNS("jmcns","加名承诺书","加名承诺书","");


    private final String key;
    private final String dir;
    private final String clmc;
    private final String zldm;

    public String key() {
        return key;
    }

    public String dir() {
        return dir;
    }
    public String zldm() {
        return zldm;
    }

    public static DocumentType get(String key) {
        return Stream.of(values())
                .filter(d -> Objects.equals(key, d.key))
                .findFirst()
                .orElse(null);
    }

    public static DocumentType getByClmc(String clmc) {
        return Stream.of(values())
                .filter(d -> Objects.equals(clmc, d.clmc))
                .findFirst()
                .orElse(null);
    }
}
